use std::fmt::Display;

use crate::TextList;

#[derive(Debug)]
pub struct Row<'input> {
    pub cells: Vec<TextList<'input>>,
}
impl<'input> Display for Row<'input> {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        for ele in self.cells.iter() {
            let _var_name = write!(f, "|{ele}");
        }
        let _var_name = write!(f, "|");
        Ok(())
    }
}

#[derive(Debug)]
pub enum TableAlign {
    Left,
    Right,
    Center,
}
impl TableAlign {
    pub fn value(&self) -> i32 {
        match self {
            TableAlign::Left => 0,
            TableAlign::Right => 1,
            TableAlign::Center => 2,
        }
    }
}
impl Display for TableAlign {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let align = match self {
            TableAlign::Left => "Left",
            TableAlign::Right => "Right",
            TableAlign::Center => "Center",
        };
        write!(f, "{align}")
    }
}
